﻿Jxstar.currentPage = function() {
	var config = {param:{},initpage:function(page, define){},eventcfg:{}};

	var auditData = Jxstar.findComboData('audit');
	var yesnoData = Jxstar.findComboData('yesno');

	var cols = [
	{col:{header:'记录状态', width:78, sortable:true, align:'center',
		editable:false,
		editor:new Ext.form.ComboBox({
			store: new Ext.data.SimpleStore({
				fields:['value','text'],
				data: auditData
			}),
			emptyText: jx.star.select,
			mode: 'local',
			triggerAction: 'all',
			valueField: 'value',
			displayField: 'text',
			editable:false,
			value: auditData[0][0]
		}),
		renderer:function(value){
			for (var i = 0; i < auditData.length; i++) {
				if (auditData[i][0] == value)
					return auditData[i][1];
			}
		}}, field:{name:'project_check__auditing',type:'string'}},
	{col:{header:'项目编号', width:100, sortable:true}, field:{name:'project_check__project_code',type:'string'}},
	{col:{header:'项目名称', width:181, sortable:true}, field:{name:'project_check__project_name',type:'string'}},
	{col:{header:'项目实施情况', width:214, sortable:true}, field:{name:'project_check__done_content',type:'string'}},
	{col:{header:'项目负责人', width:100, sortable:true}, field:{name:'project_check__project_user',type:'string'}},
	{col:{header:'验收日期', width:100, sortable:true, align:'center',
		renderer:function(value) {
			return value ? value.format('Y-m-d') : '';
		}}, field:{name:'project_check__check_date',type:'date'}},
	{col:{header:'验收负责人', width:100, sortable:true}, field:{name:'project_check__check_user',type:'string'}},
	{col:{header:'参加人员', width:100, sortable:true}, field:{name:'project_check__other_user',type:'string'}},
	{col:{header:'实施部门', width:100, sortable:true}, field:{name:'project_check__dept_name',type:'string'}},
	{col:{header:'实际工期(月)', width:100, sortable:true, align:'right',renderer:JxUtil.formatNumber(2)}, field:{name:'project_check__project_month',type:'float'}},
	{col:{header:'质保期(月)', width:100, sortable:true, align:'right',renderer:JxUtil.formatInt()}, field:{name:'project_check__quality_month',type:'int'}},
	{col:{header:'竣工日期', width:100, sortable:true, align:'center',
		renderer:function(value) {
			return value ? value.format('Y-m-d') : '';
		}}, field:{name:'project_check__end_date',type:'date'}},
	{col:{header:'验收纪要', width:100, sortable:true, hidden:true}, field:{name:'project_check__check_desc',type:'string'}},
	{col:{header:'质量评定', width:100, sortable:true, hidden:true}, field:{name:'project_check__check_result',type:'string'}},
	{col:{header:'登记人', width:64, sortable:true}, field:{name:'project_check__edit_user',type:'string'}},
	{col:{header:'登记单号', width:100, sortable:true}, field:{name:'project_check__check_code',type:'string'}},
	{col:{header:'备注', width:100, sortable:true, hidden:true}, field:{name:'project_check__check_memo',type:'string'}},
	{col:{header:'项目ID', width:100, sortable:true, hidden:true}, field:{name:'project_check__project_id',type:'string'}},
	{col:{header:'验收负责人ID', width:100, sortable:true, hidden:true}, field:{name:'project_check__check_userid',type:'string'}},
	{col:{header:'部门ID', width:100, sortable:true, hidden:true}, field:{name:'project_check__dept_id',type:'string'}},
	{col:{header:'主键', width:100, sortable:true, hidden:true}, field:{name:'project_check__check_id',type:'string'}},
	{col:{header:'登记人ID', width:100, sortable:true, hidden:true}, field:{name:'project_check__edit_userid',type:'string'}},
	{col:{header:'上传验收单', width:100, sortable:true, hidden:true}, field:{name:'project_check__check_file',type:'string'}},
	{col:{header:'是否单项验收', width:100, sortable:true, hidden:true, align:'center',
		editable:false,
		editor:new Ext.form.ComboBox({
			store: new Ext.data.SimpleStore({
				fields:['value','text'],
				data: yesnoData
			}),
			emptyText: jx.star.select,
			mode: 'local',
			triggerAction: 'all',
			valueField: 'value',
			displayField: 'text',
			editable:false,
			value: yesnoData[0][0]
		}),
		renderer:function(value){
			for (var i = 0; i < yesnoData.length; i++) {
				if (yesnoData[i][0] == value)
					return yesnoData[i][1];
			}
		}}, field:{name:'project_check__check_contract',type:'string'}},
	{col:{header:'项目负责人id', width:100, sortable:true, hidden:true}, field:{name:'project_check__project_userid',type:'string'}}
	];
	
	config.param = {
		cols: cols,
		sorts: null,
		hasQuery: '1',
		isedit: '0',
		isshow: '1',
		funid: 'project_check'
	};
	
	
	config.eventcfg = {				mycheck: function(){			var records = this.grid.getSelectionModel().getSelections();			if (!JxUtil.selected(records)) return;						var self = this;			//取选择记录的主键值			var params = 'funid='+ self.define.nodeid;			for (var i = 0; i < records.length; i++) {				params += '&keyid=' + records[i].get(self.define.pkcol);			}			//设置请求的参数			params += '&pagetype=grid&eventcode=mycheck';			//执行处理的内容			var endcall = function(data) {				//重新加载数据				self.grid.getStore().reload();			};			//发送请求			Request.postRequest(params, endcall);		}
	};
		
	return new Jxstar.GridNode(config);
}